<?php
// liste des membres inscrits sur le compte mail de la personne connectée
if (!$_SESSION['is_connect']) {
	return;
}

$user_id = isset($_GET['id']) ? $_GET['id'] : $_SESSION['id'];
$member = member_get_by_id($user_id);
$history = member_get_history($user_id);

// check autorisation
if ($member == null || $member['email'] != $_SESSION['email'] ) {
	return;
}
?>

<h2>Historique</h2>

<p>Historique du compte <?php echo sprintf("<strong>%s %s</strong> (%s)", $member['firstname'], $member['name'], $member['email']); ?></p>

<table class="data-display">
	<tr>
		<th>Statut</th>
		<th>Date de changement</th>
	</tr>
	<?php
	while ($row = mysql_fetch_assoc($history)) {
		echo '
		<tr>
			<td><strong style="color: '.$row['status_color'].';">'.$row['status_label'].'</strong></td>
			<td>'.date_to_str($row['created_at']).'</td>
		</tr>';
	}
	?>
</table>

<p>
<?php
if ($user_id == $_SESSION['id']) {
	echo apple_button('espace_adh-my_account.html', 'Retour');
}
else {
	echo apple_button('espace_adh-profils.html', 'Retour');
}
?>
</p>
